@burstjs/crypto
Cryptographic functions for building Burstcoin apps.
Installation
Install using npm:
npm install @burstjs/crypto
or using yarn:
yarn add @burstjs/crypto
API Reference
Members
- BN
Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team
Functions
- decryptAES(encryptedBase64, key) ⇒
Decrypt an encrypted message
- generateMasterKeys(passPhrase) ⇒
Generate the Master Public Key and Master Private Key for a new passphrase
- generateSignature(messageHex, privateKey)
Generate a signature for the transaction
Method:
s = sign(sha256(sha256(transactionHex)_keygen(sha256(sha256(transactionHex)_privateKey)).publicKey),
sha256(sha256(transactionHex)_privateKey),
privateKey)
p = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
- generateSignedTransactionBytes(unsignedTransactionHex, signature) ⇒
Generates a signed message digest
- getAccountIdFromPublicKey(publicKey) ⇒
Convert hex string of the public key to the account id
- verifySignature(signature, messageHex, publicKey)
Verify a signature for given message
BN
Original work Copyright (c) 2018 PoC-Consortium
Modified work Copyright (c) 2019 Burst Apps Team
Kind: global variable
decryptAES(encryptedBase64, key) ⇒
Decrypt an encrypted message
Kind: global function
Returns:
The decrypted content
Param | Description |
---|
encryptedBase64 | encryprts data in base64 format |
key | The secret key |
generateMasterKeys(passPhrase) ⇒
Generate the Master Public Key and Master Private Key for a new passphrase
Kind: global function
Returns:
EC-KCDSA sign key pair + agreement key
Param | Description |
---|
passPhrase | The passphrase |
generateSignature(messageHex, privateKey)
Generate a signature for the transaction
Method:
s = sign(sha256(sha256(transactionHex)_keygen(sha256(sha256(transactionHex)_privateKey)).publicKey),
sha256(sha256(transactionHex)_privateKey),
privateKey)
p = sha256(sha256(transactionHex)_keygen(sha256(transactionHex_privateKey)).publicKey)
Kind: global function
Param | Description |
---|
messageHex | The data in hexadecimal representation |
privateKey | The private key for signing |
generateSignedTransactionBytes(unsignedTransactionHex, signature) ⇒
Generates a signed message digest
Kind: global function
Returns:
The signed message digest
Param | Description |
---|
unsignedTransactionHex | The unsigned message |
signature | The signature |
getAccountIdFromPublicKey(publicKey) ⇒
Convert hex string of the public key to the account id
Kind: global function
Returns:
The numeric account Id
Param | Description |
---|
publicKey | The public key |
verifySignature(signature, messageHex, publicKey)
Verify a signature for given message
Kind: global function
Param | Description |
---|
signature | The signature to be verified |
messageHex | The message data in hexadecimal representation |
publicKey | The public key |